package com.gongj.shej.策略模式;

/**
 * @program: shej
 * @description:
 * @author: gongj
 * @Description: TODO
 * @create: 2020-07-23 19:54
 **/
public enum StrategyEnum {
    A(5,"strategy5"),
    B(10,"strategy10"),
    C(20,"strategy20"),
    D(30,"strategy30"),
    ;
    private Integer money;
    private String beanName;

    public static StrategyEnum findStrategyEnum(Integer money){
        StrategyEnum[] values = StrategyEnum.values();
        for (StrategyEnum value : values) {
            if(value.getMoney().equals(money)){
                return value;
            }
        }
        return null;
    }
    StrategyEnum(Integer money,String beanName) {
        this.money = money;
        this.beanName = beanName;
    }

    public Integer getMoney() {
        return money;
    }

    public void setMoney(Integer money) {
        this.money = money;
    }

    public String getBeanName() {
        return beanName;
    }

    public void setBeanName(String beanName) {
        this.beanName = beanName;
    }}
